<template>
  <div>

    <el-table
        :data="tableData"
        style="width: 100%;text-align: center">
      <el-table-column
          prop="id"
          label="id"
          header-align="center"
          width="280">
      </el-table-column>
      <el-table-column
          prop="name"
          label="名字"
          header-align="center"
          width="280">
      </el-table-column>
      <el-table-column
          prop="content"
          label="说明"
          header-align="center"
          width="280">
      </el-table-column>
      <el-table-column label="操作" min-width="100" fixed="right" header-align="center">
        <template slot-scope="scope">
          <el-button size="small" @click="checkDataOperation(scope.row)" type="primary">编辑</el-button>
        </template>
      </el-table-column>
    </el-table>

  </div>
</template>

<script>

import {checkDataOperation} from "@/api/test"
export default {
  name: 'dataRange',
  data() {
    return {
      tableData:[{ id:1,name:'有权限编辑数据',content:"1有权限， 2没有权限"},{ id:2,name:'没有权限编辑数据',content:"1有权限， 2没有权限"}]
    }
  },
  mounted() {
  },
  methods: {
    checkDataOperation(data){
      checkDataOperation(data).then(res =>{
         console.log("res",res)
        this.$message.success("成功编辑数据")
       }).catch(err =>{
        console.log("err",err)
        this.$message.success("无权限编辑")
      })
    }
  }
}
</script>

<style scoped lang="scss">

</style>
